﻿--TODO: url secure flags?

CREATE TABLE [steve].[ContentImportStaging]
(
	SystemName varchar(50) not null,
	ExternalId varchar(100) not null,
	CreateDate datetime2(7) not null,
	CreateMembershipId uniqueidentifier null,
	[Language] varchar(10) not null,
	[Path] varchar(255) not null,
	ContentTypeName varchar(50) not null,
	OriginalContentData varbinary(max),
	CleanContentData varbinary(max),
	OriginalTitle nvarchar(200) null,
	CleanTitle nvarchar(200) null,
	OriginalTeaser nvarchar(4000) null,
	CleanTeaser nvarchar(4000) null,
	PublicationDate datetime2(7),
	PublisherUrlAuthority varchar(255) null,
	PublisherUrl varchar(800) null,
	Publisher nvarchar(200) null,
	Author nvarchar(200) null,
	Height int null,
	Width int null,
	MimeType varchar(50) null,
	MimeSubtype varchar(50) null,
	RevisionDate datetime2(7) not null,
	RevisionMembershipId uniqueidentifier null,
	ReadyToProcess bit not null,
	Processed datetime2(7) null,
	OriginalUrl1Authority varchar(255) null,
	OriginalUrl1 varchar(800) null,
	OriginalUrl2Authority varchar(255) null,
	OriginalUrl2 varchar(800) null,
	OriginalUrl3Authority varchar(255) null,
	OriginalUrl3 varchar(800) null
)

GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'A common import table for external systems to send data to Steve.', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging';

GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Unique identifier of the external system (this is preconfigured).', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'SystemName';

GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Unique identifier of this content in the external system.', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'ExternalId';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Clean data (binary form, UTF-8 if string)', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'CleanContentData';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Preconfigured content type in Steve', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'ContentTypeName';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'If applicable', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'Height';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Currently only "en-US" is supported.', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'Language';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Most likely "html"', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'MimeSubtype';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Most likely "text"', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'MimeType';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Original data (before any cleaning, in binary form, UTF-8 if string)', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'OriginalContentData';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'If any rewrites should be created', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'OriginalUrl2';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'If any rewrites should be created', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'OriginalUrl2Authority';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'If any rewrites should be created', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'OriginalUrl3';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'If any rewrites should be created', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'OriginalUrl3Authority';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Path to the content (starts with leading slash, ie. "/paul/page-1")', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'Path';

go
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'If applicable', @level0type = N'SCHEMA', @level0name = N'steve', @level1type = N'TABLE', @level1name = N'ContentImportStaging', @level2type = N'COLUMN', @level2name = N'Width';

